/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package htmlunit.code;

import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.Socket;

/**
 *
 * @author TiTa
 */
public class kiemtra_net {
  
    public static boolean kiemtra() {
    String   site= "google.com";
    Socket sock = new Socket();
    InetSocketAddress addr = new InetSocketAddress(site,80);
    try {
        sock.connect(addr,3000);
        System.out.print("xác nhận kết nối"+"\n");
        return true;
    } catch (IOException e) {
           System.out.print("không có kết nối"+"\n");
           e.printStackTrace();
        return false;
    } finally {
        try {sock.close();}
        catch (IOException e) {}
    }
    }


}
